package app.server.s01;

import app.model.AppBasedoc;

import com.agile.jfinal.controller.CoreController;
import com.jfinal.ext.render.DwzRender;

/**
 * 查找带回类
 * @author qiutian
 *
 */
public class LookUpController extends CoreController {
	
	
	/**
	 * 默认方法查询数据
	 */
	public void index(){
		
		//生成全部数据的树形菜单
		try {
			logger("执行查找带回！");
			AppBasedoc appBasedoc = getModel(AppBasedoc.class);
			
			appBasedoc.setLikeColumn(appBasedoc.VCODE+appBasedoc.VNAME);
			setAttr("appBasedoc", appBasedoc);
			setAttr("page", appBasedoc.queryPaginate(getPageNumber(), getPageSize())); //分页查d
			renderJsp("/WEB-INF/jsp/app/server/s01/lookup.jsp");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			logger("执行查找带回失败！");
			e.printStackTrace();
			render(DwzRender.error(e.getMessage()));
		}
	}
	
	
	/**
	 * 查找带回下拉框中的数据
	 */
	public void suggest(){
		
		//生成全部数据的树形菜单
		try {
			logger("执行查找带回下拉加载！");
			AppBasedoc appBasedoc = getModel(AppBasedoc.class);	
			renderJson(appBasedoc.getList());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			logger("执行查找带回下拉加载失败！");
			e.printStackTrace();
			render(DwzRender.error(e.getMessage()));
		}
		
	}
	
}
